package Test.ThirdThree;

import java.util.GregorianCalendar;

/**
 * Student 实现Person接口
 */
public class Student implements Person {

    private int sID;
    private String speciality;
    private String name;
    private char sex;
    private GregorianCalendar birthday;


    public Student(String name,char sex,GregorianCalendar birthday,int sID,String speciality){
        setData(name,sex,birthday);
        this.sID=sID;
        this.speciality=speciality;
    }

    /**
     * 实现接口中的setData()方法
     * @param name      姓名
     * @param sex       性别
     * @param birthday  生日
     */
    @Override
    public void setData(String name,char sex,GregorianCalendar birthday){
        this.name=name;
        this.sex=sex;
        this.birthday=birthday;
    }

    /**
     * 设置成员变量specility
     * @param speciality 专业
     */
    public void setSpeciality(String speciality) {
        this.speciality = speciality;
    }


    /**
     * 设置成员变量sID
     * @param sID        学号
     */
    public void setsID(int sID) {
        this.sID = sID;
    }


    /**
     * 实现接口中的getData()方法
     * (调用toString()方法)
     */
    @Override
    public String getData() {
        return this.toString();
    }

    @Override
    public String toString(){
            return " 姓名："+name+" 性别："+sex+" 生日："+birthday.toZonedDateTime()+
                    " 学号："+sID+" 专业："+speciality;

    }

    public static void main(String[] args) {
        GregorianCalendar birthday=new GregorianCalendar(1998,1,12);
        Student student=new Student("毛建国",'男',birthday,12,"软件工程");
        System.out.println(student.getData());
    }


}
